package com.qingsong.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

import static com.qingsong.constant.RE.INFO_RE;
import static com.qingsong.constant.RE.INFO_RE_MSG;

@Schema(name = "秒杀添加DTO")
@Data
public class SeckillInsertDTO implements Serializable {
    @NotNull(message = "秒杀标题不能为空")
    @Schema(description = "秒杀标题")
    private String title;

    @NotEmpty(message = "描述不能为空")
    @Schema(description = "秒杀描述")
    @Pattern(regexp = INFO_RE, message = INFO_RE_MSG)
    private String info;

    @NotNull(message = "活动状态不能为空")
    @Range(min = 0, max = 2, message = "性别代码必须在0~2之间")
    @Schema(description = "活动状态")
    private Integer status;

    @Future(message = "开始时间必须是一个未来的时间")
    @NotNull(message = "开始时间不能为空")
    @Schema(description = "开始时间")
    private LocalDateTime startTime;

    @NotNull(message = "秒杀活动结束时间不能为空")
    @Schema(description = "秒杀活动结束时间")
    private LocalDateTime endTime;
}